package com.zzyl.nursing.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzyl.nursing.domain.Reservation;
import com.zzyl.nursing.dto.ReservationDto;
import com.zzyl.nursing.vo.CountVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface MemberReservationMapper extends BaseMapper<Reservation> {


    @Update("update reservation set status=2,update_time=#{updateTime} where id=#{id}")
    void cancel(@Param("id") Long id, @Param("updateTime") LocalDateTime updateTime);

    public int getCancelledCount(@Param("userId") Long userId, @Param("startOfDay") String startOfDay, @Param("endOfDay") String endOfDay);
//    public int getCancelledCount(@Param("startOfDay") LocalDateTime startOfDay, @Param("endOfDay") LocalDateTime endOfDay);

    void add(Reservation reservation);

    List<Reservation> page(Integer status);

    List<CountVo> getCountByTime(@Param("startOfDay") LocalDateTime startOfDay, @Param("endOfDay") LocalDateTime endOfDay);
}
